﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InHD.utilities;

namespace InHD.model
{
    class Transaction
    {
        #region Fields for update database
        public int ID { get; set; }
        public DateTime Modified { get; set; }
        public string TaxUNK { get; set; }
        public double DiscountAmount { get; set; }
        public double TotalSaleAmount { get; set; }
        public string InvoiceTemplateUnk { get; set; }
        public TransTypes TransactionType { get; set; }
        public string AccountUNK { get; set; }
        public string CustomerUnk { get; set; }
        public string StaffUnk { get; set; }
        public string TransactionUNK { get; set; }
        public int Status { get; set; }
        public string CustomerFirstName { get; set; }
        public string CustomerLastName { get; set; }
        public string TaxName { get; set; }
        public string ArchiveFlag { get; set; }
        public double TaxPercentage { get; set; }
        public PaymentTypes PaymentType { get; set; }
        #endregion

        #region Creation
        public static Transaction CreateNewTransaction()
        {
            return new Transaction();
        }

        public static Transaction CreateTransaction(
            DateTime modified,
            string taxUnk,
            double discAmt,
            double totalSaleAmt,
            string invTmplUnk,
            TransTypes transType,
            string accUnk,
            string cusUnk,
            string staffUnk,
            int status,
            string customerFName,
            string customerLName,
            string taxName,
            double taxPercentage,
            PaymentTypes paymentType)
        {
            return new Transaction
            {
                Modified = modified,
                TaxUNK = taxUnk,
                DiscountAmount = discAmt,
                TotalSaleAmount = totalSaleAmt,
                AccountUNK = accUnk,
                CustomerUnk = cusUnk,
                StaffUnk = staffUnk,
                InvoiceTemplateUnk = invTmplUnk,
                TransactionUNK = "TRA-"+Guid.NewGuid().ToString(),
                Status = status,
                CustomerFirstName = customerFName,
                CustomerLastName = customerLName,
                TaxName = taxName,
                TaxPercentage = taxPercentage,
                PaymentType = paymentType
            };
        }

        protected Transaction()
        {
        }

        #endregion // Creation
    }
}
